###[view/SeatGrid.py]
from PySide6.QtWidgets import QPushButton

from model.Student import Student

class StudentButton(QPushButton):
    """独立的学生按钮类，包含学生数据引用"""

    def __init__(self, student: Student):
        super().__init__(f"{student.stu_id}\n{student.name}")
        self.student = student  # 持有学生对象引用
        self.setFixedSize(60, 40)
        self.setCheckable(True)
        self.setStyleSheet("""
            QPushButton {
                background-color: darkgrey;
                border: 1px solid black;
                border-radius: 4px;
            }
            QPushButton:checked {
                background-color: green !important;
                border: 2px solid darkgreen !important;
            }
        """)
